﻿unit SmOrderDtlService;

interface
{$I ../Config.inc}
uses
  FastMM4,
  FastMove,
  System.SysUtils,
  System.Classes,
  System.Types,
  Winapi.Windows,
  Data.DB,
  Data.Win.ADODB,
  Datasnap.DBClient,
  Datasnap.Provider,
  {$IFDEF UNICODE}
  AnsiStrings,
  {$ENDIF }
  QBParcel,
  DllSpread,
  Generics.Collections,
  DateUtils,
  QJson,
  UserConnection,
  DBAccessor,
  DllPlugin,
  StrUtils,
  SK0001Comm,
  SmOrderDtlModel,
  SmOrderDtlBLL;
  
type


  TSmOrderDtlService = class(TSmOrderDtlBLL)
  private
  
  protected
  
  public
  {$IFDEF SERVER}
    function BeforeTreatment(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    function BeforeTreatment(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;

    function BeforeCheck(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    function BeforeCheck(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    
    function Check(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    function Check(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
  
    function BeforeExecute(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    function BeforeExecute(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
  
    function AfterTreatment(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
    function AfterTreatment(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;overload;override;
  {$ENDIF}
  end;
  
implementation

{$IFDEF SERVER}
function TSmOrderDtlService.BeforeTreatment(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  if iItem<>nil then
  begin
    case iPreMode of
    pmNone: ;
    pmAdd:
      begin
        iItem.OrderPk:=iItem.ObjGUID;
        iItem.OrderDtlSendQty:=iItem.OrderDtlQty;
        iItem.OrderDtlSettlementAmount:=0;
      end;
    pmEdit:
      begin
        iItem.OrderDtlSendQty:=iItem.OrderDtlQty;
        iItem.OrderDtlSettlementAmount:=0;
      end;
    pmDelete:
      begin
      end;
    pmSendApprove: ;
    pmApprove: ;
    pmUnApprove: ;
    pmCancel: ;
    pmUnCancel: ;
    pmPrint: ;
    pmUnPrint: ;
    pmAccount: ;
    pmUnAccount: ;
    pmIgnore: ;
    pmUnIgnore: ;
    pmUse: ;
    pmUnUse: ;
    end;
  end else begin
    oError:=Format(string('调用%s.BeforeTreatment单例方法失败 错误内容:传入的字符串或对象为空!'),[Self.ClassName]);
    Result:=False;
    Exit;
  end;
  Result:=True;
end;

function TSmOrderDtlService.BeforeTreatment(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.BeforeCheck(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.BeforeCheck(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.Check(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.Check(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.BeforeExecute(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.BeforeExecute(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.AfterTreatment(const iItem:TSmOrderDtl; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;

function TSmOrderDtlService.AfterTreatment(const iItems:TSmOrderDtlList; const iPreMode:ePretreatmentMode; const iParcel:TQBParcel; out oError:string):Boolean;
begin
  Result:=True;
end;
{$ENDIF}
  
end.
